﻿CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
PROJECT(NFMMOLogicPlayerPlugin)

set(SRC_LIST
		./
		Base
		Player
		Trans
		Part
		Package
		ObService
		NFlog
		Event
		GlobalData
		HealthGame
		Session
		Login
		LineUp
		WhiteList
		Account
		Bag
		Buff
		Skill
		Misc
		Hero
		Pve
		BattleDrug
		Credit
		Partner
		Map
		LifeSkill
		Escort
		Shop
		TrapTower
		SixExperiment
		Welfare
		Militant
		Title
		Fashion
		Sns
		GuildCompetition
		MasterQuest
		AuctionCompetition
		License
		SkyArena
		CreditShop
		PhantomTroupe
		State
		Arena
		Sign
		SignInMonth
		Dungeon
		Cheat
		TreasureHunt
		Wanted
		Pay
		MultiLevel
		ActivityEight
		Gift
		Ce
		Chat
		AutoRecover
		RisingPurchase
		LevelBless
		TormentTower
		LegentRoad
		1v1
		ChallengeTower
		InfiniteDungeon
		Raid
		Retrive
		Return
		Plat
		Trade
		ServerLevel
		Level
		Avatar
		AheadCost
		Battle
		CD
		CityBuff
		Counter
		EventLog
		Hall
		NianPractice
		OnlineReward
		Roulette
		Skin
		WelfareExp
		NoviceGuide
		Quest
        Team
        Friend
		Online
        Mirror
        Room
        BattleCorps
        Master
        Activity
        Mall
		GM
		GM/UnitTest/Bag
	)

foreach( _var ${SRC_LIST})
	include_directories(${_var})
	aux_source_directory(${_var} SRC)
endforeach()

if (CMAKE_BUILD_TYPE STREQUAL "Release")

	ADD_LIBRARY( ${PROJECT_NAME} STATIC ${SRC} )
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")

	ADD_LIBRARY( ${PROJECT_NAME} STATIC ${SRC} )
elseif (CMAKE_BUILD_TYPE STREQUAL "DynamicRelease")

	ADD_LIBRARY( ${PROJECT_NAME} SHARED ${SRC} )
	# 只对 CMake 目标建立依赖关系（系统库和库文件名不是 CMake 目标）
	add_dependencies(${PROJECT_NAME} ${NFSHM_CORE_LIBS} ${NFSHM_SERVER_COMMON_LIBS} ${LIREN_GAME_COMMON_LIBS})
	# 动态库需要链接核心库、系统库和游戏逻辑库才能使用相关符号
	TARGET_LINK_LIBRARIES(${PROJECT_NAME} 
		${NFSHM_CORE_LIBS} 
		${NFSHM_SYSTEM_LIBS}
		${NFSHM_SERVER_COMMON_LIBS} ${LIREN_GAME_COMMON_LIBS}
	)
elseif(CMAKE_BUILD_TYPE STREQUAL "DynamicDebug")
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")

	ADD_LIBRARY( ${PROJECT_NAME} SHARED ${SRC} )
	# 只对 CMake 目标建立依赖关系（系统库和库文件名不是 CMake 目标）
	add_dependencies(${PROJECT_NAME} ${NFSHM_CORE_LIBS} ${NFSHM_SERVER_COMMON_LIBS} ${LIREN_GAME_COMMON_LIBS})
	# 动态库需要链接核心库、系统库和游戏逻辑库才能使用相关符号
	TARGET_LINK_LIBRARIES(${PROJECT_NAME} 
		${NFSHM_CORE_LIBS} 
		${NFSHM_SYSTEM_LIBS}
		${NFSHM_SERVER_COMMON_LIBS} ${LIREN_GAME_COMMON_LIBS}
	)
endif()

# ============================================================================
# Install 配置
# ============================================================================
# 只有动态库版本才需要安装
if (CMAKE_BUILD_TYPE STREQUAL "DynamicRelease")
    install(TARGETS ${PROJECT_NAME}
            LIBRARY DESTINATION "Bin/DynamicRelease"
            RUNTIME DESTINATION "Bin/DynamicRelease"
            ARCHIVE DESTINATION "Bin/DynamicRelease")
elseif(CMAKE_BUILD_TYPE STREQUAL "DynamicDebug")
    install(TARGETS ${PROJECT_NAME}
            LIBRARY DESTINATION "Bin/DynamicDebug"
            RUNTIME DESTINATION "Bin/DynamicDebug"
            ARCHIVE DESTINATION "Bin/DynamicDebug")
endif()

